//
//  JCComposeButton.swift
//  SinaWeibo_18
//
//  Created by apple on 15/10/23.
//  Copyright © 2015年 cz. All rights reserved.
//

import UIKit

let COMPOSE_BUTTONW: CGFloat = 80
let COMPOSE_BUTTONH: CGFloat = 110

class JCComposeButton: UIButton {

    //移除高亮状态
   override var highlighted: Bool{
    set{
    }
    get{
        return false
    }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        size = CGSizeMake(COMPOSE_BUTTONW, COMPOSE_BUTTONH)
        //文字居中
        titleLabel?.textAlignment = NSTextAlignment.Center
        //文字颜色
        setTitleColor(RGB(r: 100, g: 100, b: 100), forState: UIControlState.Normal)
        //文字大小
        titleLabel?.font = UIFont.systemFontOfSize(14)
        //设置图片模式
        imageView?.contentMode = UIViewContentMode.Center
    }
    override func layoutSubviews() {
        super.layoutSubviews()
        //调整图片
        imageView?.x = 0
        imageView?.y = 0
        imageView?.width = self.width
        imageView?.height = self.width
        //调整label
        titleLabel?.x = 0
        titleLabel?.y = self.width
        titleLabel?.width = self.width
        titleLabel?.height = self.height - self.width
    }
    
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}
